#ifndef __SPINLOCK_H__
#define __SPINLOCK_H__

#include "types.h"

// 互斥锁
struct spinlock {
  uint locked;       // 锁是否被持有

  // For debugging:
  char *name;        // 锁的名称
  struct cpu *cpu;   // 持有锁的CPU
};

void acquire(struct spinlock*);
void release(struct spinlock*);
void push_off(void);
void pop_off(void);

#endif // __SPINLOCK_H__
